package com.zzp.zjs_bos.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Repository;

import com.zzp.zjs_bos.dao.IFunctionDao;
import com.zzp.zjs_bos.dao.base.BaseDaoImpl;
import com.zzp.zjs_bos.domain.Function;
import com.zzp.zjs_bos.domain.User;

@Repository
public class FunctionDaoImpl extends BaseDaoImpl<Function> implements IFunctionDao {

	public List<Function> findByUserId(String id) {
		String hql = "from Function f left outer join fetch f.roles r left outer join fetch r.users u where u.id=?";
		
		return this.getHibernateTemplate().find(hql, id);
	}

	public List<Function> findMenuByUserId(String id) {
		String hql = "from Function f left outer join fetch f.roles r left outer join fetch r.users u where u.id=? and f.generatemenu='1' order by f.zindex desc ";
		
		return this.getHibernateTemplate().find(hql, id);
	}

	public List<Function> findAllMenu() {
		String hql = "from Function f where f.generatemenu='1' order by f.zindex desc";
		return this.getHibernateTemplate().find(hql);
	}

	
	

}
